<html>
<head><meta charset="utf-8"><title>build-std · t-cargo · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/index.html">t-cargo</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/build-std.html">build-std</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="233415524"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/build-std/near/233415524" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> ender <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/build-std.html#233415524">(Apr 07 2021 at 01:11)</a>:</h4>
<p>What are the default features of build-std?</p>
<p>I know "core" and "alloc" are a subset of features, but what is the default set?</p>
<p>Also, what is the difference between <code>build-std</code> and <code>build-std-features</code> in your <code>config.toml</code>?</p>
<p>I tried running <code>cargo +nightly build</code></p>
<p>with the setting </p>
<div class="codehilite"><pre><span></span><code>[unstable]
build-std = [&quot;core&quot;, &quot;alloc&quot;, &quot;compiler_builtins&quot;,&quot;libc&quot;]
</code></pre></div>
<p>in the <code>.cargo/config.toml</code> file and received errors.</p>



<a name="233417064"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/build-std/near/233417064" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> ender <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/build-std.html#233417064">(Apr 07 2021 at 01:32)</a>:</h4>
<p>Are these the default settings?</p>
<div class="codehilite"><pre><span></span><code>[unstable]
build-std = [&quot;core&quot;,&quot;std&quot;,&quot;alloc&quot;,&quot;proc_macro&quot;]
</code></pre></div>



<a name="233420029"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/build-std/near/233420029" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Eric Huss <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/build-std.html#233420029">(Apr 07 2021 at 02:13)</a>:</h4>
<p>@ender The <code>build-std</code> setting sets which crates to compile which is independent of the features (set by <code>build-std-features</code>).  </p>
<p>There's some documentation at <a href="https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#build-std">https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#build-std</a>:</p>
<blockquote>
<p>Using -Z build-std will implicitly compile the stable crates core, std, alloc, and proc_macro. If you're using cargo test it will also compile the test crate.</p>
</blockquote>
<p>And just below that:</p>
<blockquote>
<p>The default enabled features, at this time, are backtrace and panic_unwind.</p>
</blockquote>



<a name="233754848"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/build-std/near/233754848" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> XAMPPRocky <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/build-std.html#233754848">(Apr 09 2021 at 01:25)</a>:</h4>
<p>Related: Is there a way to enable a feature only for specific crate with <code>build-std-features</code>? I want to ensure that <code>compiler_builtins</code> is always built with the <code>mem</code>. But setting <code>build-std-features=mem</code> doesn’t work for testing because <code>test</code> doesn’t have that feature, and it doesn’t seem like <code>build-std-features=compiler_builtins/mem</code> works.</p>



<a name="233759274"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/build-std/near/233759274" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Eric Huss <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/build-std.html#233759274">(Apr 09 2021 at 02:27)</a>:</h4>
<p><span class="user-mention" data-user-id="219696">@XAMPPRocky</span> The feature <code>compiler-builtins-mem</code> should work for both. Does that work for you? (I haven't tested).</p>



<a name="233759367"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/build-std/near/233759367" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> XAMPPRocky <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/build-std.html#233759367">(Apr 09 2021 at 02:28)</a>:</h4>
<p>I’ll give it a shot when I’m back at my machine. Thanks 🙏</p>



<a name="233870198"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/build-std/near/233870198" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> ender <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/build-std.html#233870198">(Apr 09 2021 at 18:33)</a>:</h4>
<p><span class="user-mention silent" data-user-id="120518">Eric Huss</span> <a href="#narrow/stream/246057-t-cargo/topic/build-std/near/233420029">said</a>:</p>
<blockquote>
<p>@ender The <code>build-std</code> setting sets which crates to compile which is independent of the features (set by <code>build-std-features</code>).  </p>
<p>There's some documentation at <a href="https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#build-std">https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#build-std</a>:</p>
<blockquote>
<p>Using -Z build-std will implicitly compile the stable crates core, std, alloc, and proc_macro. If you're using cargo test it will also compile the test crate.</p>
</blockquote>
<p>And just below that:</p>
<blockquote>
<p>The default enabled features, at this time, are backtrace and panic_unwind.</p>
</blockquote>
</blockquote>
<p>This is very useful. I appreciate your help.</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>